home *** CD-ROM | disk | FTP | other *** search
/ Beginning Mac Programming / Beginning Mac Programming.bin / pc / Open Me for REALbasic 3 / REALbasic 3.2 / Example Projects / Reusable Classes_Code / User Interface / MS Style Controls / read me < prev   
Encoding:
Text File  |  2000-02-28  |  7.1 KB  |  154 lines

  1. MS Button Classes 2.1
  2.  
  3. Written & Compiled by:
  4. Will Cosgrove
  5. wcosgrov@nwciowa.edu
  6.  
  7. • Everyday Software
  8. http://www.public.iastate.edu/~cosy
  9.  
  10. Hi there,
  11. Here are 4 classes I wrote and/or compiled to help in making Outlook style buttons.  I really didn't have any purpose in writing these classes, I just did it because I wanted to experiment with the canvas object in Realbasic.  Well, the buttons turned out better then I thought they would, so I made them public.  This code is freely updateable, in fact, I encourage you to update the code base.  If you do improve the code, please email me the project file with comments where necessary.  This project is about making the best and easiest buttons possible for as many people as possible!
  12.  
  13. Programming:
  14. I made the methods as "open" as possible and will continue to do so.  Users have to define the properties of the buttons in an Open method.  If you look at the sample project you'll figure it out faster then reading the following...  
  15.  
  16. Universal Properties:
  17.  
  18. textFont (buttonTextFont in CBetterPopupMenu)
  19. me.textFont = "System"
  20. - sets the font on the button.
  21.  
  22. textSize (buttonTextFont in CBetterPopupMenu)
  23. me.textSize = 12
  24. - sets the size of the font on the button .
  25.  
  26. caption
  27. me.caption = "Button Text Here"
  28. - sets the text that appears on the button.
  29.  
  30. autoCenterV
  31. me.autoCenterV = true
  32. - If true, the button will center the text/graphics vertically regardless of size.
  33.    If false, it will place the text/graphics in the default location.
  34.  
  35. state
  36. me.state = 0
  37. - the state of the button on open (usually 0), only has to be set on open.
  38.    0 is the normal state.
  39.    1 is up state.
  40.    2 is down state.
  41.  
  42. Universal Methods:
  43.  
  44. getSWidth()
  45. me.width = me.getSWidth()
  46. - gets the suggested width of the button, returns an integer. 
  47.     - can be used to set the width of the button at runtime, or used to msgbox the width of the button so that it can be set in the IDE.
  48.  
  49. action()
  50. - write the code you want fired on the action of the button here (except in the CBetterPopupMenu).
  51.  
  52. Buttons with Pictures Properties:
  53.  
  54. ResIconID
  55. me.resIconID = 3000
  56. - sets the icon for the button, must be a CICN resource
  57.  
  58. Button with Menu Properties:
  59.  
  60. TextFont
  61. me.TextFont = "Geneva"
  62. - sets the font of the menu
  63.  
  64. TextSize
  65. me.TextSize = 9
  66. - sets the size of the font in the menu
  67.  
  68. ** All other methods in the CBetterPopupMenu Documentation **
  69. ** Contact Fabian Lidman regarding the CBetterPopupMenu (I only did the look of the button) **
  70.  
  71. _____________________________
  72.  
  73.  
  74. Credit Where Credit is Due:
  75. If you decide to use this code I ask two things.  First, email me and tell me that you're using the classes.  And second, please give Fabian and Me some credit if you use any of our code.  I worked hard on these and I don't think that's too much to ask, is it?  In your read me file or about window (if you use them) just write something like: "MS Style Button Classes by: Will Cosgrove,  http://www.public.iastate.edu/~cosy".  If you use the CBetterPopupMenu please also credit Fabian Lidman.  Thanks!
  76.  
  77. Contact:
  78. If you have any questions or comments feel free to write me at wcosgrov@nwciowa.edu.
  79.  
  80. Special Thanks:
  81. Fabian Lidman - Menu Handling Code (CBetterPopupMenu 1.5)
  82. http://www.kagi.com/fabian/ 
  83.  
  84. Other Code Contributors:
  85. Jacob Lauritzen, Scott Crick, Matt Ridley
  86.  
  87. Known Issues:
  88. On the action command you may not fire the window.close() method, this will cause RB to crash.  If you want to close the window using an MSButton you have to use the CloseMSButton subclass and change it's super to the correct button style you are using.  Then uncomment all the code in the mouseup event that starts with "//."  After that, change the canvas' super to the subclass.  Got all that? 
  89.  
  90. Version History
  91.  
  92. 2.1
  93. by Will Cosgrove, Matt Ridley
  94. - Changed icons to CICN resources and now handle the drawing of enabled, disabled, and normal states of the icon within the button classes.  Original code by Fabin Lidman, modified by Matt Ridley and Me.
  95. - Changed the CBetterPopupMenu's down arrow to be draw within the class instead of using a resource.  Now is theme savvy.
  96. - Fixed button text variables in the CBetterPopup class that I missed from the last update, oops.
  97.  
  98.  
  99. 2.0
  100. By Will Cosgrove
  101.  
  102. - Reworked MS buttons to be THEME and scheme savvy.  Happy times are here at last! =)
  103.    Notes:
  104.     - In systems under 8.5 the buttons will draw as if they were under Platinum with the standard RB fillColor.  Feel free to add support for systems below 8.0 in the StandardColor() methods.
  105.     - As an added bonus, I believe all the color system calls being made in MSButtons are Carbon compliant.
  106.     - The button's backdrop is still a solid color, but it's theme savvy.  I'm working on getting this fixed, but any help would be great.
  107.     - I one-upped MS and also made the MSCanvas savvy.
  108.     - Feel free to use the color variables in the method setColor() in the rest of your project, if applicable.
  109. - Implemented Fabian's CBetterPopupMenu 1.5.
  110. - In the CBetterPopupMenu the properties for the button text is now buttonText*, and the properties for the menu are Text*.   The reason for the change:  I didn't feel like going through all Fabian's code and changing his variables again.
  111. - Minor line drawing inaccuracy fixed.
  112.  
  113. 1.6
  114. By Will Cosgrove
  115.  
  116. - Made MS button classes Kaleidoscope savvy (except for the disabled text, any ideas on that, let me know).  
  117.         Notes:
  118.     - The buttons aren't quite as accurate, but they look a lot better with kaleidoscope running.  I thought it was a decent trade-off. 
  119.     - RB color calls aren't Apperance Manager savvy . =\  Hopefully they will fix that soon!  
  120.     - RB's textColor call isn't correct, I'm not sure where they get it from, but on some schemes the color isn't right.
  121.     - FYI: The MS Settings button is not savvy because frankly...it has no hope because it's so nonstandard.
  122. - Implemented Fabian's CBetterPopupMenu 1.2, fixes a menu bug.
  123. - Added a CloseMSButton subclass.  You can now close the parent window with the CloseMSButton (see know issues above).
  124. - changed the cursor to nil when exiting buttons
  125. - Various minor code tweaks.
  126.  
  127. 1.5  
  128. by Will Cosgrove, Jacob Lauritzen, Scott Crick
  129.  
  130. - Arranged the code in a more object oriented way, opimized code.
  131. - Corrected the MS Settings button colors, doh!  And other Settings button stuff.
  132. - Added a MS/Palm style dialog box for all to enjoy.
  133. - Added the action() method, this method is fired on the action of the button.  
  134. - Changed the devStringWidth() method to the getSWidth() method and it now returns an int instead of void.
  135. - The getSWidth() now returns the correct value if there is no caption on the button.
  136. - Changed the button's text variable to caption, to better conform to...something....
  137. - Added the ability to have the buttons be any size and draw correctly.  
  138. - Added the ability to have any size picture in the button and draw correctly.
  139. - Added the ability to use any font.
  140. - Added the ability to use any font size.
  141. - Buttons now draw off-screen before being drawn on the canvas to reduce flicker.
  142. - Modified Fabian Lidman's CBetterPopupMenu to look like a MS button and included it in the project.
  143.  
  144.  
  145. 1.01 
  146. by Will Cosgrove
  147.  
  148. - Fixed a bug that would cause the buttons not to enabled correctly.
  149.  
  150.  
  151. 1.0
  152. by Will Cosgrove
  153.  
  154.  - Inital release of MS buttons.